# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: damir <damir@archlinux.org>

pkgname=qsynth
pkgver=0.9.12
pkgrel=1
pkgdesc="Qt GUI for FluidSynth"
arch=(loong64 x86_64)
url="https://qsynth.sourceforge.io/"
license=(GPL-2.0-or-later)
groups=(pro-audio)
depends=(
  gcc-libs
  glibc
  hicolor-icon-theme
  qt6-base
  qt6-svg
)
makedepends=(
  cmake
  fluidsynth
  qt6-tools
)
optdepends=(
  'qt6-wayland: for native wayland support'
)
source=(https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz)
sha512sums=('44017d24c09714d174c774083462f7dc263f2abc7aaf7d2cda0f4987b007210a33dcfb35d47eacd5682859e5299f75e26e47fd2f73458eb2a05a36c27d5889f0')
b2sums=('778edbb60535aea55f3d82074e8723b37fef6fa01975403211317753f790e14baf9f59db294f68e3d067a2142b450878cfaf412ad22480744936a2eee1d654d1')

build() {
  local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CONFIG_QT6=ON
    -S $pkgname-$pkgver
    -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

package() {
  depends+=(
    fluidsynth libfluidsynth.so
  )

  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $pkgname-$pkgver/{ChangeLog,README,TRANSLATORS} -t "$pkgdir/usr/share/doc/$pkgname"
}
